﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Liger.Web.Common;
using Liger.Web.Common.Extensions;

namespace Liger.Web.UI
{
    public class TextBoxBuilder : UIComponentBuilderBase, IHideObjectMembers
    {
        private TextBox TextBox
        {
            get
            {
                return this.Component as TextBox;
            }
        }


        public TextBoxBuilder()
            : base(new TextBox())
        {

        }

        public TextBoxBuilder(TextBox TextBox)
            : base(TextBox)
        {

        }

        /// <summary>
        /// 设置属性
        /// </summary>
        /// <param name="property"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public TextBoxBuilder Set(string property, object value)
        {
            if (this.TextBox.Properties.ContainsKey(property))
            {
                this.TextBox.Properties[property] = value;
            }
            else
            {
                this.TextBox.Properties.Add(property, value);
            }
            return this;
        }

        /// <summary>
        /// 返回ligerTextBox的Manager
        /// </summary>
        /// <param name="manager">manager的对象名</param>
        /// <returns></returns>
        public TextBoxBuilder Manager(string manager)
        {
            this.TextBox.Manager = manager;
            return this;
        }


        public TextBoxBuilder Width(string value)
        {
            this.TextBox.Width = value;
            return this;
        }
        public TextBoxBuilder Disabled(bool value)
        {
            this.TextBox.Disabled = value;
            return this;
        }
        public TextBoxBuilder Value(string value)
        {
            this.TextBox.Value = value;
            return this;
        }
        public TextBoxBuilder NullText(string value)
        {
            this.TextBox.NullText = value;
            return this;
        }
        public TextBoxBuilder Digits(bool value)
        {
            this.TextBox.Digits = value;
            return this;
        }
        public TextBoxBuilder Number(bool value)
        {
            this.TextBox.Number = value;
            return this;
        }
    }
}